package de.koller.oceanFramework.plain.util;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;

public class RViewport {
	public final Graphics2D graphics;
	public final int bwidth, bheight;
	public final BufferedImage bitmap;
	public final RRaster raster;

	public RViewport( int bitmapWidth, int bitmapHeight ) {
		this.bwidth = bitmapWidth;
		this.bheight = bitmapHeight;
		
		this.bitmap = new BufferedImage( bwidth, bheight, BufferedImage.TYPE_INT_RGB );
		raster = new RRaster( ((DataBufferInt)bitmap.getRaster().getDataBuffer()).getData(), bwidth, bheight );
		graphics = bitmap.createGraphics();
	}

	public void release() {
		graphics.dispose();
	}
	
}
